package com.loongtech.bi.manager.realTime;

import com.loongtech.bi.entity.realTime.EntityAuanyCreateuser;
import com.loongtech.bi.manager.system.ConfigManager;
import com.loongtech.bi.synch.DataSyncher;
import com.loongtech.core.jpa.manager.ManagerQueryCacheBase;
import com.loongtech.core.util.Time;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * Author: yuri
 * Description:  实时数据-auany日新增用户manager
 * Date: 14:32 2017/4/11
 */
@Service
public class AuanyCreateuserManager extends ManagerQueryCacheBase<EntityAuanyCreateuser> {
	private static final long serialVersionUID = 1L;

    @Resource
    private ConfigManager configManager;

	public List<Object[]> getAuanyNewUserByChannel(Date lookDate) {
        // System.out.println("111111111111111111" + configManager.getConfigValueByName(DataSyncher.TagGameId));
        // System.out.println("22222222222222222" +  Time.getDateStr(lookDate).replaceAll("-",""));
        return queryBySql("select substring_index(fulluseridentity, '$', -1) as platform,devicecategory,COUNT(DISTINCT fulluseridentity) from auany_createuser where gameid = " + configManager.getConfigValueByName(DataSyncher.TagGameId) + " and dt = " + Time.getDateStr(lookDate).replaceAll("-","") + " group by platform,devicecategory");
	}

}
